home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / clue.lha / clue / doc / clue.tex / node250_mn.html < prev    next >
Text File  |  1989-07-12  |  3KB  |  62 lines

  1.  
  2. <H3><A ID="SECTION007011100000000000000"><tex2html_anchor_invisible_mark></A> <A ID="ch:representation-types"><tex2html_anchor_mark></A><BR>
  3. Representation Types
  4. </H3><#5386#>
  5.            
  6.       
  7.  
  8. A representation type <A ID="3513"><tex2html_anchor_invisible_mark></A><A ID="3514"><tex2html_anchor_invisible_mark></A> allows an application to 
  9. request different representations of the same resource value. For example, a
  10. color value might be represented either as a name string (``red''), a pixel
  11. value, an RGB
  12. triplet, an HSV triplet, etc. Only one representation for the resource value is
  13. actually stored in a resource database. Conversion functions may be invoked
  14. to return a representation type different from the one stored.
  15.  
  16. <P>
  17. The representation type used for a contact resource is defined by the <#3515#><TT>:type</TT><#3515#> option of its resource specification in the <#3516#><TT>defcontact</TT><#3516#>.  During
  18. contact initialization, a contact resource value read from a resource
  19. database by <#3517#><TT>make-contact</TT><#3517#>
  20. <A ID="3518"><tex2html_anchor_invisible_mark></A>
  21. is automatically converted
  22. to its specified representation type.
  23.  
  24. <P>
  25. CLUE performs resource representation type conversion by calling the
  26. <#3519#><TT>convert</TT><#3519#> function.  
  27. <A ID="3520"><tex2html_anchor_invisible_mark></A>
  28. CLUE defines methods for the <#3521#><TT>convert</TT><#3521#> function to handle all standard
  29. conversions. 
  30. The standard representation type conversions provided by CLUE are shown
  31. in Figure~<A HREF=<tex2html_cr_mark>#fig:conversions#3522><tex2html_cr_mark></A>.<A ID="3523"><tex2html_anchor_invisible_mark></A>
  32.  
  33. <P>
  34. In order
  35. to define a new representation type, the contact programmer must define
  36. methods for <#3524#><TT>convert</TT><#3524#> that handle the new representation type appropriately. Typically,
  37. <#3525#><TT>convert</TT><#3525#> methods will specify parameter specializers for <#3526#><TT>type</TT><#3526#>
  38. (e.g. <#4541#><TT>(eql <#3527#><EM>data-type</EM><#3527#>)</TT><#4541#>) and for <#3528#><TT>value</TT><#3528#> and will be defined only
  39. for each valid source/destination type pair. 
  40.  
  41. <P>
  42. <#4542#><FONT SIZE="+1"><#3529#><B>convert Method</B><#3529#></FONT><#4542#>
  43. <A ID="3530"><tex2html_anchor_invisible_mark></A>
  44. <A ID="3531"><tex2html_anchor_invisible_mark></A>
  45. <DIV class="RIGHT">
  46. <tex2html_image_mark>#tex2html_wrap_inline10545#
  47. </DIV>
  48.  
  49. <P>
  50.  
  51. <DIV class="CENTER"><A ID="fig:conversions"><tex2html_anchor_mark></A><A ID="3555"><tex2html_anchor_mark></A>
  52. <TABLE>
  53. <CAPTION class="BOTTOM"><STRONG><#10546#>Figure<#10546#>:</STRONG>
  54. <#10547#>Standard Type Conversions<#10547#></CAPTION>
  55. <TR><TD><tex2html_image_mark>#figure3554#</TD></TR>
  56. </TABLE>
  57. </DIV>
  58.  
  59.  
  60. <P>
  61.  
  62.  =0 <#5396#>=0 <#5400#>